#pragma once
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>

using namespace std;
class Util{
public:
    //输入：const &
    //输出：*
    //输入+输出：&
    static bool StringSplit(const string &str, const string &sep, vector<string>* res){

        size_t start = 0;
        while (start < str.size())
        {
            auto pos = str.find(sep, start);
            if(pos == string::npos){
                break;
            }else{
                res->push_back(str.substr(start, pos - start));
            }
            start = pos + sep.size();
        }
        //保存截取完成后的最有一段数据
        if(start<str.size()){
            res->push_back(str.substr(start));
        }
        return true;
    }

    static int toInt(const string& str){
        return atoi(str.c_str());
    }
};